<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1999-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CO_BROADCAST (The GNU Fortran Compiler)</title>

<meta name="description" content="CO_BROADCAST (The GNU Fortran Compiler)">
<meta name="keywords" content="CO_BROADCAST (The GNU Fortran Compiler)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Intrinsic-Procedures.html#Intrinsic-Procedures" rel="up" title="Intrinsic Procedures">
<link href="CO_005fMAX.html#CO_005fMAX" rel="next" title="CO_MAX">
<link href="CMPLX.html#CMPLX" rel="prev" title="CMPLX">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<a name="CO_005fBROADCAST"></a>
<div class="header">
<p>
Next: <a href="CO_005fMAX.html#CO_005fMAX" accesskey="n" rel="next">CO_MAX</a>, Previous: <a href="CMPLX.html#CMPLX" accesskey="p" rel="prev">CMPLX</a>, Up: <a href="Intrinsic-Procedures.html#Intrinsic-Procedures" accesskey="u" rel="up">Intrinsic Procedures</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="CO_005fBROADCAST-_002d_002d_002d-Copy-a-value-to-all-images-the-current-set-of-images"></a>
<h3 class="section">8.63 <code>CO_BROADCAST</code> &mdash; Copy a value to all images the current set of images</h3>
<a name="index-CO_005fBROADCAST"></a>
<a name="index-Collectives_002c-value-broadcasting"></a>

<dl compact="compact">
<dt><em>Description</em>:</dt>
<dd><p><code>CO_BROADCAST</code> copies the value of argument <var>A</var> on the image with
image index <code>SOURCE_IMAGE</code> to all images in the current team.  <var>A</var>
becomes defined as if by intrinsic assignment.  If the execution was
successful and <var>STAT</var> is present, it is assigned the value zero.  If the
execution failed, <var>STAT</var> gets assigned a nonzero value and, if present,
<var>ERRMSG</var> gets assigned a value describing the occurred error.
</p>
</dd>
<dt><em>Standard</em>:</dt>
<dd><p>Technical Specification (TS) 18508 or later
</p>
</dd>
<dt><em>Class</em>:</dt>
<dd><p>Collective subroutine
</p>
</dd>
<dt><em>Syntax</em>:</dt>
<dd><p><code>CALL CO_BROADCAST(A, SOURCE_IMAGE [, STAT, ERRMSG])</code>
</p>
</dd>
<dt><em>Arguments</em>:</dt>
<dd><table>
<tr><td width="20%"><var>A</var></td><td width="65%">INTENT(INOUT) argument; shall have the same
dynamic type and type parameters on all images of the current team. If it
is an array, it shall have the same shape on all images.</td></tr>
<tr><td width="20%"><var>SOURCE_IMAGE</var></td><td width="65%">a scalar integer expression.
It shall have the same value on all images and refer to an
image of the current team.</td></tr>
<tr><td width="20%"><var>STAT</var></td><td width="65%">(optional) a scalar integer variable</td></tr>
<tr><td width="20%"><var>ERRMSG</var></td><td width="65%">(optional) a scalar character variable</td></tr>
</table>

</dd>
<dt><em>Example</em>:</dt>
<dd><div class="smallexample">
<pre class="smallexample">program test
  integer :: val(3)
  if (this_image() == 1) then
    val = [1, 5, 3]
  end if
  call co_broadcast (val, source_image=1)
  print *, this_image, &quot;:&quot;, val
end program test
</pre></div>

</dd>
<dt><em>See also</em>:</dt>
<dd><p><a href="CO_005fMAX.html#CO_005fMAX">CO_MAX</a>, <br>
<a href="CO_005fMIN.html#CO_005fMIN">CO_MIN</a>, <br>
<a href="CO_005fSUM.html#CO_005fSUM">CO_SUM</a>, <br>
<a href="CO_005fREDUCE.html#CO_005fREDUCE">CO_REDUCE</a>
</p></dd>
</dl>






</body>
</html>
